<template>
  <div class="menus">
    <div class="nav2">
      <ul>
        <li
          v-for="(val,ind) in skills"
          :key="ind"
          @click="addClass($event,ind),to(val.path)"
          :class="{current:current==ind}"
        >
          <span>{{val.title}}</span>
        </li>
      </ul>
    </div>
  </div>
</template>
<script>
import { mapState, mapActions } from "vuex";
export default {
  data() {
    return {
      current: 0
    };
  },
  computed: {
    ...mapState(["skills"])
  },
  methods: {
     to(url){
           this.$router.push(url);
      },
     addClass(evt,ind) {
      this.current=ind;
      this.$parent.id=ind;
    }
  }
};
</script>
<style lang="">
.menus {
  height: .8rem;
  width: 100%;
  display: flex;
}
.nav2 {
  flex-shrink: 1;
  width: 100%;
}
.nav2 ul {
  height: 0.8rem;
  display: flex;
  justify-content: space-around;
  align-items: center;
  overflow-x: scroll;
}
.nav2 ul li {
  position: relative;
  border-bottom: none;
  width: 1.rem;
  text-align: center;
  color: #666;
  border-bottom: 2px solid #fff;
}
.nav2 ul li.current {
  border-bottom: 2px solid #2c72ac;
  color: #2c72ac;
}
.nav2 ul li.current a {
  color: #2c72ac;
}
</style>